
#ifndef stm32f10x_io
#define stm32f10x_io

#include "appdefs.h"
#include "stm32f10x_conf.h"

typedef struct {
  GPIO_TypeDef* port;
  uint16_t pins;
} GPIOPort;

#define ON    1
#define OFF   0


void config_adc(ADC_TypeDef* ADCx);

u16 get_adc(ADC_TypeDef* ADCx, u8 channel);


void config_di(const GPIOPort* io, GPIOMode_TypeDef _mode);

uint8_t get_inbit(const GPIOPort* io);

void config_do(const GPIOPort* io, GPIOMode_TypeDef _mode);

void set_outbit(const GPIOPort* io, int value);

#endif
